package demo3;

public class Test {
    public static void main(String[] args) {
        String str = "hello";

        StringBuffer str1 = new StringBuffer();
        for (int i = 0; i < str.length(); i++) {
            str1.append(str.charAt(i));
        }
        String str2 = str1.toString();
        System.out.println(str2);

        StringBuilder str4 = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            str4.append(str.charAt(i));
        }
        System.out.println(str4.toString());
    }
}
